import matplotlib.pyplot as plt
import numpy as np

# 创建数据
np.random.seed(42)
n_points = 100
x = np.random.randn(n_points)
y = np.random.randn(n_points)
colors = np.random.rand(n_points)
sizes = 1000 * np.random.rand(n_points)

# 创建图表
plt.figure(figsize=(10, 8))

# 绘制散点图
scatter = plt.scatter(x, y, c=colors, s=sizes, alpha=0.6, cmap='viridis')

# 添加颜色条
plt.colorbar(scatter)

# 添加标题和标签
plt.title('Scatter Plot with Random Data', fontsize=16)
plt.xlabel('X values', fontsize=12)
plt.ylabel('Y values', fontsize=12)

# 添加网格
plt.grid(True, alpha=0.3)

# 显示图表
plt.tight_layout()
plt.show()